import os

# Neo4j 配置
NEO4J_URI = os.getenv('NEO4J_URI', "bolt://localhost:7687")
NEO4J_USER = os.getenv('NEO4J_USER', "neo4j")
NEO4J_PASSWORD = os.getenv('NEO4J_PASSWORD', "Zhaowenzhe1007")

# OpenAI 配置
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY', "sk-21da7fe4005b466583d4663bf81d8505")
OPENAI_BASE_URL = os.getenv('OPENAI_BASE_URL', "https://dashscope.aliyuncs.com/compatible-mode/v1")

# MinIO 配置
MINIO_ENDPOINT = os.getenv('MINIO_ENDPOINT', "101.237.129.10:9000")
MINIO_ACCESS_KEY = os.getenv('MINIO_ACCESS_KEY', "minioadmin")
MINIO_SECRET_KEY = os.getenv('MINIO_SECRET_KEY', "minioadmin")
MINIO_BUCKET = os.getenv('MINIO_BUCKET', "query")

# Flask 配置
DEBUG = os.getenv('FLASK_DEBUG', 'True').lower() == 'true'
SECRET_KEY = os.getenv('FLASK_SECRET_KEY', "your-secret-key")

def validate_config():
    """验证配置是否完整"""
    required_configs = [
        ('NEO4J_URI', NEO4J_URI),
        ('NEO4J_USER', NEO4J_USER),
        ('NEO4J_PASSWORD', NEO4J_PASSWORD),
        ('OPENAI_API_KEY', OPENAI_API_KEY),
        ('OPENAI_BASE_URL', OPENAI_BASE_URL),
        ('MINIO_ENDPOINT', MINIO_ENDPOINT),
        ('MINIO_ACCESS_KEY', MINIO_ACCESS_KEY),
        ('MINIO_SECRET_KEY', MINIO_SECRET_KEY),
        ('MINIO_BUCKET', MINIO_BUCKET)
    ]
    
    missing_configs = [name for name, value in required_configs if not value]
    if missing_configs:
        raise ValueError(f"缺少必要的配置项: {', '.join(missing_configs)}")